 <!-- 顶部的通知消息栏目 -->
#for(topmsg : topmsgs)
<li class="green" id="topmsg_#(topmsg.id)">
	<a data-toggle="dropdown" class="dropdown-toggle" href="#" title="#(topmsg.label)">
		<i class="ace-icon fa #if(topmsg.iconCols??) #(topmsg.iconCols) #else fa-envelope#end icon-animated-vertical"></i>
		<span class="badge badge-success aa">0</span>
	</a>
	<ul class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
		<li class="dropdown-header" id="maillist">
			<i class="ace-icon fa fa-envelope-o"></i>
			<label class="bb">0</label>条未读信息
		</li>
		<li class="dropdown-content">
			<ul class="dropdown-menu dropdown-navbar msg">
				<!-- <li>
					<a href="javascript:;" onclick="">
						<span class="msg-body">
							<span class="msg-title">
								<span class="blue">#(topmsg.label):</span>
							</span>
							<span class="msg-time">
								<i class="ace-icon fa fa-clock-o"></i>
								<span>这是一条很重要的通知消息</span><br>
							</span>
						</span>
					</a>
				</li> -->
			</ul>
		</li>
		<li class="dropdown-footer">
			<a href="#(topmsg.url)" target="content">
				查看全部消息
				<i class="ace-icon fa fa-arrow-right"></i>
			</a>
		</li>
	</ul>
	<script type="text/javascript">
		/** 主键为 topmsg_#(topmsg.id) 的 li的请求数据的方法 */
		#if(topmsg.func??)
		var TopMsg#(topmsg.id) = function(){
			var topmsg = $('#topmsg_#(topmsg.id)');
			#(topmsg.func)
			getUnReadCount();
			getShowData();
			if(REFRESH_TIME > 0){
				setInterval(function(){
					getUnReadCount();
					getShowData();
				}, REFRESH_TIME);
			}
			/** 这是未读消息的功能页面  */
			var setUnReadCount = function(data){
				topmsg.find('.aa').text(data.count);
				topmsg.find('.bb').text(data.count);
			}
			
			/** 设置未读消息展示方法 */
			var setShowData = function(arr){
				var html = '';
				for(var i in arr){
					var data = arr[i];
						html+= '<li>' +
								'<a href="javascript:;" onclick="topMsg#(topmsg.id).findById('+data.id+')">' +
									'<span class="msg-body">' +
										'<span class="msg-title">' +
											'<span class="blue">#(topmsg.label):</span>' +
										'</span>' +
										'<span class="msg-time">' +
											'<i class="ace-icon fa fa-clock-o"></i>' +
											'<span>'+data.desc+'</span><br>' +
										'</span>' +
									'</span>' +
								'</a>' +
							'</li>';
				}
				topmsg.find('.msg').html(html);
			}
			
			/** 通过主键打开未读消息页面 */
			this.findById = function(id){
				findById(id);
			}
		}
		var topMsg#(topmsg.id) = new TopMsg#(topmsg.id);
		#end
	</script>
</li>
#end

